import { lazy } from "react";
import { RouteItem } from "./type";

// 一级路由
let Home = lazy(() => import('../views/Home'))
let Login = lazy(() => import('../views/Login'))
let Error = lazy(() => import('../views/Error'))

// 二级路由
let Index = lazy(() => import('../views/Index'))
let Table = lazy(() => import('../views/Table'))
let My = lazy(() => import('../views/My'))

export let homeRoutes: RouteItem[] = [{
  path: '/home/index',
  element: <Index/>,
  title: '首页',
}, 
{
  path: '/home/my',
  element: <My/>,
  title: '我的',
  role: ['my']
}]

export let routerList: RouteItem[] = [
  {
    path: '/home',
    element: <Home/>,
    children: homeRoutes
  },
  {
    path: '/login',
    element: <Login/>
  },
  {
    path: '/',
    element: <Home/>
  }, {
    path: '*',
    element: <Error/>
  }
]
